home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-04-03 | 5.7 KB | 164 lines | [TEXT/PJMM] |
- { This file has been processed by The THINK Pascal Source Converter, v1.1. }
-
- {}
- {Created: Sunday, January 6, 1991 at 11:19 PM}
- { StandardFile.p}
- { Pascal Interface to the Macintosh Libraries}
- {}
- { Copyright Apple Computer, Inc. 1990}
- { All rights reserved}
- {}
- {}
-
-
-
- { RMS 4/3/91 Modified to exclude declarations already in the THINK Pascal built-in interfaces }
-
-
- unit StandardFile;
- interface
- uses
- Types, OSUtils, Files, Dialogs;
-
- const
- { resource IDs and item offsets of 7.0 dialogs }
- sfPutDialogID = -6043;
- sfGetDialogID = -6042;
- sfItemOpenButton = 1;
- sfItemCancelButton = 2;
- sfItemBalloonHelp = 3;
- sfItemVolumeUser = 4;
- sfItemEjectButton = 5;
- sfItemDesktopButton = 6;
- sfItemFileListUser = 7;
- sfItemPopUpMenuUser = 8;
- sfItemDividerLinePict = 9;
- sfItemFileNameTextEdit = 10;
- sfItemPromptStaticText = 11;
- sfItemNewFolderUser = 12;
-
- { pseudo-item hits for use in DlgHook }
- sfHookFirstCall = -1;
- sfHookCharOffset = $1000;
- sfHookNullEvent = 100;
- sfHookRebuildList = 101;
- sfHookFolderPopUp = 102;
- sfHookOpenFolder = 103;
-
- { the following are only in system 7.0+ }
- sfHookOpenAlias = 104;
- sfHookGoToDesktop = 105;
- sfHookGoToAliasTarget = 106;
- sfHookGoToParent = 107;
- sfHookGoToNextDrive = 108;
- sfHookGoToPrevDrive = 109;
- sfHookChangeSelection = 110;
- sfHookSetActiveOffset = 200;
- sfHookLastCall = -2;
-
- { the refcon field of the dialog record during a}
- { modalfilter or dialoghook contains one of the following}
- sfMainDialogRefCon = 'stdf';
- sfNewFolderDialogRefCon = 'nfdr';
- sfReplaceDialogRefCon = 'rplc';
- sfStatWarnDialogRefCon = 'stat';
- sfLockWarnDialogRefCon = 'lock';
- sfErrorDialogRefCon = 'err ';
-
- type
- StandardFileReply = record
- sfGood: BOOLEAN;
- sfReplacing: BOOLEAN;
- sfType: OSType;
- sfFile: FSSpec;
- sfScript: ScriptCode;
- sfFlags: INTEGER;
- sfIsFolder: BOOLEAN;
- sfIsVolume: BOOLEAN;
- sfReserved1: LONGINT;
- sfReserved2: INTEGER;
- end;
-
-
- DlgHookProcPtr = ProcPtr; { FUNCTION Hook(item: INTEGER; theDialog: DialogPtr): INTEGER; }
- FileFilterProcPtr = ProcPtr; { FUNCTION FileFilter(PB: CInfoPBPtr): BOOLEAN; }
-
- { the following also include an extra parameter of "your data pointer" }
- DlgHookYDProcPtr = ProcPtr; { FUNCTION Hook(item: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr): INTEGER; }
- ModalFilterYDProcPtr = ProcPtr; { FUNCTION Filter(theDialog: DialogPtr; VAR theEvent: EventRecord; VAR itemHit: INTEGER; yourDataPtr: Ptr): BOOLEAN; }
- FileFilterYDProcPtr = ProcPtr; { FUNCTION FileFilter(PB: CInfoPBPtr; yourDataPtr: Ptr): BOOLEAN; }
- ActivateYDProcPtr = ProcPtr; { PROCEDURE Activate(theDialog; DialogPtr; itemNo: INTEGER; activating: BOOLEAN; yourDataPtr: Ptr); }
-
- SFTypeList = array[0..3] of OSType;
-
- procedure SFPutFile (where: Point; prompt: Str255; origName: Str255; dlgHook: DlgHookProcPtr; var reply: SFReply);
- inline
- $3F3C, $0001, $A9EA;
-
- procedure SFGetFile (where: Point; prompt: Str255; fileFilter: FileFilterProcPtr; numTypes: INTEGER; typeList: SFTypeList; dlgHook: DlgHookProcPtr; var reply: SFReply);
- inline
- $3F3C, $0002, $A9EA;
-
- procedure SFPPutFile (where: Point; prompt: Str255; origName: Str255; dlgHook: DlgHookProcPtr; var reply: SFReply; dlgID: INTEGER; filterProc: ModalFilterProcPtr);
- inline
- $3F3C, $0003, $A9EA;
-
- procedure SFPGetFile (where: Point; prompt: Str255; fileFilter: FileFilterProcPtr; numTypes: INTEGER; typeList: SFTypeList; dlgHook: DlgHookProcPtr; var reply: SFReply; dlgID: INTEGER; filterProc: ModalFilterProcPtr);
- inline
- $3F3C, $0004, $A9EA;
-
- procedure StandardPutFile (prompt: Str255; defaultName: Str255; var reply: StandardFileReply);
- inline
- $3F3C, $0005, $A9EA;
-
- procedure StandardGetFile (fileFilter: FileFilterProcPtr; numTypes: INTEGER; typeList: SFTypeList; var reply: StandardFileReply);
- inline
- $3F3C, $0006, $A9EA;
-
- procedure CustomPutFile (prompt: Str255; defaultName: Str255; var reply: StandardFileReply; dlgID: INTEGER; where: Point; dlgHook: DlgHookYDProcPtr; filterProc: ModalFilterYDProcPtr; activeList: Ptr; activateProc: ActivateYDProcPtr; yourDataPtr: univ Ptr);
- inline
- $3F3C, $0007, $A9EA;
-
- procedure CustomGetFile (fileFilter: FileFilterYDProcPtr; numTypes: INTEGER; typeList: SFTypeList; var reply: StandardFileReply; dlgID: INTEGER; where: Point; dlgHook: DlgHookYDProcPtr; filterProc: ModalFilterYDProcPtr; activeList: Ptr; activateProc: ActivateYDProcPtr; yourDataPtr: univ Ptr);
- inline
- $3F3C, $0008, $A9EA;
-
-
- { }
- { New StandardFile routine comments:}
- {}
- { activeList is pointer to array of integer (16-bits).}
- { first integer is length of list.}
- { following integers are possible activatable DITL items, in}
- { the order that the tab key will cycle through. The first}
- { in the list is the item made active when dialog is first shown.}
- {}
- { activateProc is a pointer to a procedure like:}
- {}
- { PROCEDURE MyActivateProc(theDialog: DialogPtr;}
- { itemNo: INTEGER;}
- { activating: BOOLEAN;}
- { yourDataPtr: Ptr);}
- {}
- { The activateProc is called with activating=FALSE on the itemNo}
- { about to deactivate then with activating=TRUE on the itemNo}
- { about to become the active item. (like activate event)}
- {}
- { yourDataPtr is a nice little extra that makes life easier without}
- { globals. CustomGetFile & CustomPPutFile when calling any of their}
- { call back procedures, pushes the extra parameter of yourDataPtr on}
- { the stack.}
- {}
- { In addition the filterProc in CustomGetFile & CustomPPutFile is called}
- { before before SF does any mapping, instead of after.}
- {}
-
-
-
- { UsingStandardFile }
-
-
- implementation
- end.
-
-